# Contributor: Bjoern Schilberg <bjoern@intevation.de>
# Maintainer: Bjoern Schilberg <bjoern@intevation.de>
pkgname=mapserver
pkgver=7.6.4
pkgrel=3
pkgdesc="CGI-based platform for publishing spatial data and interactive mapping applications to the web"
url="https://mapserver.org/"
# riscv64, s390x blocked by rust -> librsvg
arch="all !riscv64 !s390x"
license="MIT"
depends_dev="
	cmake
	libpq-dev
	geos-dev
	gdal-dev
	jpeg-dev
	giflib-dev
	libxml2-dev
	proj-dev
	fcgi-dev
	curl-dev
	freetype-dev
	cairo-dev
	protobuf-c-dev
	harfbuzz-dev
	fribidi-dev
	exempi-dev
	pixman-dev
	librsvg-dev
	"
makedepends="
	$depends_dev
	"
subpackages="
	$pkgname-dev
	"
source="
	https://download.osgeo.org/mapserver/$pkgname-$pkgver.tar.gz
	10-musl.patch
	"

build() {
	mkdir build; cd build
	cmake .. \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_BUILD_TYPE=None \
		-DWITH_GEOS=ON \
		-DWITH_POSTGIS=ON \
		-DWITH_KML=ON \
		-DWITH_WCS=ON \
		-DWITH_SOS=ON \
		-DWITH_WMS=ON \
		-DWITH_CLIENT_WMS=ON \
		-DWITH_WFS=ON \
		-DWITH_CLIENT_WFS=ON \
		-DWITH_THREAD_SAFETY=OFF \
		-DWITH_FCGI=ON \
		-DWITH_CAIRO=ON \
		-DWITH_RSVG=ON \
		-DWITH_CURL=ON \
		-DWITH_MYSQL=OFF \
		-DWITH_FRIBIDI=ON \
		-DWITH_HARFBUZZ=ON \
		-DWITH_EXEMPI=ON \
		-DWITH_PROTOBUFC=ON \
		-DWITH_PIXMAN=ON
	make
}

package() {
	make -C build DESTDIR="$pkgdir" install
	rm -rf "$pkgdir"/usr/share/
	chmod -x "$pkgdir"/usr/include/mapserver/*.h
}

sha512sums="
ccca87b650df3c1784ba82ca4a58960585d72fb4004fcea43c0dcabf03b9617ba51870bc63dbb2238a7eeb8d4337b6ff152587150912a74eeaf4a3e3d2d584ce  mapserver-7.6.4.tar.gz
52a6d6ce210f49a62dabbef712387ef1e42f3cdaf77f7248c64665fcf1a2af6b5fe116b6cecf5c95ecdb3014d353601db0dd7b715f8560ed77cd007025e17e6a  10-musl.patch
"
